package com.cloud.api.domain.sys;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.cloud.api.myenum.PublishStatusEnum;
import com.cloud.api.myenum.PublishTypeEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 
 * </p>
 *
 * @author haohaibo
 * @since 2023-09-22
 */
@Getter
@Setter
@Accessors(chain = true)
@TableName("t_version")
@Schema(name = "Version", description = "版本管理")
public class Version implements Serializable {

    private static final long serialVersionUID = 1L;

    @Schema(description = "唯一主键")
    @TableId("version_id")
    private String versionId;

    @Schema(description = "客户端系统：Android")
    @TableField("client")
    @NotEmpty(message = "发布系统不能为空")
    private String client;

    @Schema(description = "版本号")
    @TableField("version_no")
    @NotEmpty(message = "版本号不能为空")
    @Size(max = 50,message = "限制50字符")
    private String versionNo;

    @Schema(description = "构建号")
    @TableField("build_no")
    @NotNull(message = "构建号不能为空")
    private Integer buildNo;

    @Schema(description = "升级包名称")
    @TableField("package_name")
    private String packageName;

    @Schema(description = "升级包路径")
    @TableField("package_url")
    private String packageUrl;

    @Schema(description = "升级包大小")
    @TableField("package_size")
    private String packageSize;

    @Schema(description = "最低兼容版本")
    @TableField("lowest_allow_version")
    private Integer lowestAllowVersion;

    @Schema(description = "发布方式,枚举")
    @TableField("publish_type")
    private PublishTypeEnum publishType;

    @Schema(description = "更新描述")
    @TableField("update_description")
    @Size(max = 500,message = "限制500字符")
    private String updateDescription;

    @Schema(description = "存量设备数")
    @TableField("equipment_num")
    private int equipmentNum;

    @Schema(description = "发布状态")
    @TableField("publish_status")
    private PublishStatusEnum publishStatus;

    @Schema(description = "定时发布时间")
    @TableField("regular_publish_time")
    private LocalDateTime regularPublishTime;

    @Schema(description = "发布时间")
    @TableField("publish_time")
    private LocalDateTime publishTime;

    @Schema(description = "创建时间",hidden = true)
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    @Schema(description = "更新时间",hidden = true)
    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;

    @Schema(description = "创建人",hidden = true)
    @TableField(value = "create_user",fill = FieldFill.INSERT)
    private String createUser;

    @Schema(description = "修改人",hidden = true)
    @TableField(value = "update_user", fill = FieldFill.INSERT_UPDATE)
    private String updateUser;

    @Schema(description = "删除标记",hidden = true)
    @TableField("deleted")
    private int deleted;
}
